<template>
  <div class="app-container">
    <div class="app-container_conter">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px" style="display: flex;align-items: flex-end;justify-content: space-between">
      <div>
      <el-form-item label="职业" prop="industryId">
        <treeselect style="width: 220px" v-model="queryParams.industryId" :options="industryOptions"
                    :normalizer="normalizer" placeholder="请选择职业"/>
      </el-form-item>
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="实际用工单位" prop="actualUnit" label-width="150">
        <el-input
            v-model="queryParams.actualUnit"
            placeholder="请输入实际用工"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报案日期" prop="createTime" style="margin-bottom: 10px">
        <el-date-picker
            v-model="queryParams.createTime"
            type="date"
            placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
          <el-option
            v-for="dict in statusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="被保险人" prop="userId">
        <el-select v-model="queryParams.userId" placeholder="请选择被保险人" clearable size="small">
          <el-option
              v-for="item in insured"
              :key="item.user_id"
              :label="item.user_name"
              :value="item.user_id"
          />
        </el-select>
      </el-form-item>
      </div>
      <div style="width: 150px;">
      <el-form-item style="width: 150px;text-align: right">
        <el-button type="primary"  size="mini" @click="handleQuery">搜索</el-button>
        <el-button type="info" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
      </div>
    </el-form>

    <el-row :gutter="10" class="mb8">

      <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          @click="handleExport"
          v-hasPermi="['insurance:repordRecord:export']"
        >导出
        </el-button>
      </el-col>
    </el-row>
    <el-table v-loading="loading" :data="repordRecordList" @selection-change="handleSelectionChange"  :header-cell-style="tableHeaderColor">
      <el-table-column type="selection"  align="center"/>
      <el-table-column label="保单号"  align="center" prop="insure_no" fixed min-width="180px" />
      <el-table-column label="被保险人" align="center" prop="user_name" idth="100"/>
      <el-table-column label="姓名" align="center" prop="name" idth="100"/>
      <el-table-column label="实际用工单位" align="center" prop="actual_unit" width="150"/>
      <el-table-column label="劳动合同单位" align="center" prop="labor_unit" width="250"/>
<!--      <el-table-column label="业务来源单位" align="center" prop="businessUnit"/>-->
      <el-table-column label="事故发生时间" align="center" prop="accident_time" width="130">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.accident_time, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <!--      <el-table-column label="工种" align="center" prop="industryId" />-->
<!--      <el-table-column label="事故经过" align="center" prop="description"/>-->
<!--      <el-table-column label="工种名称" align="center" prop="industryName"/>-->
      <el-table-column label="预估金额" align="center" prop="estimate_money"/>
      <el-table-column label="已决赔款" align="center" prop="decided_money"/>
      <el-table-column label="审核失败原因" align="center" prop="reason" width="150"/>
      <el-table-column label="创建时间" align="center" prop="create_time" width="150"/>
      <el-table-column label="更新时间" align="center" prop="update_time" width="150" />
<!--      <el-table-column label="工种百分比" align="center" prop="employerPerc"/>-->
      <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" min-width="100px"/>
      <el-table-column label="操作"  fixed="right" align="center" class-name="small-padding fixed-width"  min-width="200px">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleDetails(scope.row)"
            v-hasPermi="['insurance:repordRecord:query']"
          >详情
          </el-button>
          <el-button
            size="mini"
            type="text"
            @click="handeImage(scope.row)"
            v-hasPermi="['insurance:repordRecord:uploadDate']"
            v-if="scope.row.status=='0' "
          >资料上传</el-button>
<!--           v-show="scope.row.status=='2'"-->
          <el-button
            v-show=" scope.row.status=='1' || scope.row.status=='2'"
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['insurance:repordRecord:resubmit']"
          >修改
          </el-button>
<!--          <el-button-->
<!--            v-show="scope.row.status!='2'"-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate1(scope.row)"-->
<!--            v-hasPermi="['insurance:repordRecord:edit']"-->
<!--          >修改</el-button>-->
          <el-button
              style="color:#FF0000 "
            size="mini"
            type="text"
            @click="handleDelete(scope.row)"
            v-hasPermi="['insurance:repordRecord:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    </div>
    <pagination
        style="background: transparent"
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改报案对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="姓名" prop="name">
              <el-input v-model="form.name" placeholder="请输入姓名" readonly/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="报案时间" prop="createTime">
              <el-date-picker clearable size="small"
                              v-model="form.createTime"
                              type="date"
                              format="yyyy-MM-dd"
                              value-format="yyyy-MM-dd"
                              placeholder="选择报案时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="保单号" prop="insure_no">
              <el-input v-model="form.insure_no" placeholder="请输入保单号" readonly/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="证件号码" prop="idCardNo">
              <el-input v-model="form.idCardNo" placeholder="请输入证件号码" readonly/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="劳动合同单位" prop="laborUnit">
              <el-input v-model="form.laborUnit" placeholder="请输入劳动合同单位" readonly/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="实际用工单位" prop="actualUnit">
              <el-input v-model="form.actualUnit" placeholder="请输入实际用工单位" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="工种名称" prop="industryName">
              <el-input v-model="form.industryName" placeholder="请输入工种名称" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="所属地区" prop="area">
              <el-input v-model="form.area" placeholder="请输入所属地区" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="事故时间" prop="accidentTime">
              <el-date-picker clearable size="small"
                              v-model="form.accidentTime"
                              type="date"
                              format="yyyy-MM-dd"
                              value-format="yyyy-MM-dd"
                              placeholder="选择事故时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事故类型" prop="accident_type">
              <el-select v-model="form.accident_type" placeholder="请选择">
                <el-option
                    v-for="item in accidentType"
                    :key="item.dictValue"
                    :label="item.dictLabel"
                    :value="item.dictValue">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事故地点" prop="accident_area">
              <el-input v-model="form.accident_area" placeholder="请输入事故地点" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="受伤部位" prop="injured_part ">
              <el-input v-model="form.injured_part " placeholder="请输入受伤部位" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否骨折" prop="is_fracture">
              <el-radio-group v-model="form.is_fracture">
                <el-radio
                    v-for="dict in statusOptions1"
                    :key="dict.dictValue"
                    :label="dict.dictValue"
                >{{dict.dictLabel}}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="治疗方式" prop="treatment">
              <el-input v-model="form.treatment" placeholder="请输入治疗方式" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="住院几楼几号床" label-width="130px" prop="number">
              <el-input v-model="form.number" placeholder="请输入住院几号楼几号床" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="预估费用" prop="estimateMoney">
              <el-input v-model="form.estimateMoney" placeholder="请输入预估费用" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="医院" prop="hospital">
              <el-input v-model="form.hospital" placeholder="请输入医院" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="24">
            <el-form-item label="受伤经过" prop="description">
              <el-input v-model="form.description" type="textarea" style="width:90%" :rows="5" show-word-limit
                        maxlength="300" placeholder="请输入受伤经过"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row style="margin-top:20px;">
          <el-col :span="8">
            <el-form-item label="事故现场照片" prop="medical_invoice" >
              <div v-if="show6"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #EAC552"  @click="getidCard6">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard6">
                <img  :src="url+form.medical_invoice" style="margin-right: 5px;margin-bottom: 5px" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="手持身份证照片" label-width="130px" prop="id_card " >
              <div v-if="show7"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #EAC552"  @click="getidCard7">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard1">
                <img  :src="url+form.id_card" style="margin-right: 5px;margin-bottom: 5px" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="受伤部位照片" prop="medical_history" >
              <div v-if="show8"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #EAC552"  @click="getidCard8">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard2">
                <img  :src="url+form.medical_history" style="margin-right: 5px;margin-bottom: 5px" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="身份证" prop="identity_card" ref="uploadElement">
              <div v-if="show"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #d9d9d9"
                   @click="getidCard">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard">
                <img v-for="(item,index) in form.identity_card" style="margin-right: 5px;margin-bottom: 5px" :src="url+item"
                     width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="住院小结" prop="hospitalized">
              <div v-if="show1"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #d9d9d9"
                   @click="getidCard1">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard1">
                <img v-for="(item,index) in form.hospitalized" :src="url+item"
                     style="margin-right: 5px;margin-bottom: 5px" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="病历本" prop="medical_record_book">
              <div v-if="show2"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #d9d9d9"
                   @click="getidCard2">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard2">
                <img v-for="(item,index) in form.medical_record_book" style="margin-right: 5px;margin-bottom: 5px"
                     :src="url+item" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="医疗发票" prop="hospital_invoice">
              <div v-if="show3"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #d9d9d9"
                   @click="getidCard3">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard3">
                <img v-for="(item,index) in form.hospital_invoice" :src="url+item"
                     style="margin-right: 5px;margin-bottom: 5px" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用药清单" prop="medications">
              <div v-if="show4"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #d9d9d9"
                   @click="getidCard4">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard4">
                <img v-for="(item,index) in form.medications" :src="url+item"
                     style="margin-right: 5px;margin-bottom: 5px" width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="其他图片" prop="other">
              <div v-if="show5"
                   style="width: 150px;height: 150px;line-height: 150px;text-align: center;border: 1px solid #d9d9d9"
                   @click="getidCard5">
                <i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;color: #d9d9d9"></i>
              </div>
              <div v-else style="display: flex;flex-flow: wrap;align-items: center;" @click="getidCard5">
                <img v-for="(item,index) in form.other" :src="url+item" style="margin-right: 5px;margin-bottom: 5px"
                     width="130" height="100px">
              </div>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button type="info" @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 上传身份证-->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="650px" append-to-body>
      <el-upload
        ref="upload"
        :limit="10"
        action
        :before-upload="beforeUploadForm"
        :auto-upload="false"
        :show-file-list="true"
        :http-request="handleUpdateForm"
        multiple
        :file-list="fileList"
        drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button type="info" @click="upload.open= false">取 消</el-button>
      </div>
    </el-dialog>
    <!--  上传住院小结-->
    <el-dialog :title="upload1.title" :visible.sync="upload1.open" width="650px" append-to-body>
      <el-upload
        ref="upload1"
        :limit="10"
        action
        :http-request="handleUpdateForm1"
        :before-upload="beforeUploadForm1"
        :auto-upload="false"
        :show-file-list="true"
        multiple
        :file-list="fileList1"
        drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>

        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm1">确 定</el-button>
        <el-button type="info" @click="upload1.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <!--  上传病例本-->
    <el-dialog :title="upload2.title" :visible.sync="upload2.open" width="650px" append-to-body>
      <el-upload
        ref="upload2"
        action
        :limit="10"
        :http-request="handleUpdateForm2"
        :before-upload="beforeUploadForm2"
        :auto-upload="false"
        :show-file-list="true"
        multiple
        :file-list="fileList2"
        drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>

        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm2">确 定</el-button>
        <el-button type="info" @click="upload2.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="upload3.title" :visible.sync="upload3.open" width="650px" append-to-body>
      <el-upload
        ref="upload3"
        action
        :limit="10"
        :http-request="handleUpdateForm3"
        :before-upload="beforeUploadForm3"
        :auto-upload="false"
        :show-file-list="true"
        multiple
        :file-list="fileList3"
        drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>

        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm3">确 定</el-button>
        <el-button type="info" @click="upload3.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="upload4.title" :visible.sync="upload4.open" width="650px" append-to-body>
      <el-upload
        ref="upload4"
        action
        :limit="10"
        :http-request="handleUpdateForm4"
        :before-upload="beforeUploadForm4"
        :auto-upload="false"
        :show-file-list="true"
        multiple
        :file-list="fileList4"
        drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>

        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm4">确 定</el-button>
        <el-button type="info" @click="upload4.open = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="upload5.title" :visible.sync="upload5.open" width="650px" append-to-body>
      <el-upload
        ref="upload5"
        action
        :limit="10"
        :http-request="handleUpdateForm5"
        :before-upload="beforeUploadForm5"
        :auto-upload="false"
        :show-file-list="true"
        multiple
        :file-list="fileList5"
        drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>

        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm5">确 定</el-button>
        <el-button type="info" @click="upload5.open = false">取 消</el-button>
      </div>
    </el-dialog>
<!--   事故现场照片-->
    <el-dialog :title="upload6.title" :visible.sync="upload6.open" width="650px" append-to-body>
      <el-upload
          ref="upload6"
          :limit="1"
          action
          :before-upload="beforeUploadForm6"
          :auto-upload="false"
          :show-file-list="true"
          :http-request="handleUpdateForm6"
          multiple
          :file-list="fileList6"
          drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm6">确 定</el-button>
        <el-button type="info" @click="upload6.open= false">取 消</el-button>
      </div>
    </el-dialog>
<!--    手持身份证照片-->
    <el-dialog :title="upload7.title" :visible.sync="upload7.open" width="650px" append-to-body>
      <el-upload
          ref="upload7"
          :limit="1"
          action
          :before-upload="beforeUploadForm7"
          :auto-upload="false"
          :show-file-list="true"
          :http-request="handleUpdateForm7"
          multiple
          :file-list="fileList7"
          drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm7">确 定</el-button>
        <el-button type="info" @click="upload7.open= false">取 消</el-button>
      </div>
    </el-dialog>
<!--    受伤部位照片-->
    <el-dialog :title="upload8.title" :visible.sync="upload8.open" width="650px" append-to-body>
      <el-upload
          ref="upload8"
          :limit="1"
          action
          :before-upload="beforeUploadForm8"
          :auto-upload="false"
          :show-file-list="true"
          :http-request="handleUpdateForm8"
          multiple
          :file-list="fileList8"
          drag
      >
        <img src="../../../assets/images/Import.png" style="width: 83px;height: 91px;margin: 50px 0;"/>
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div class="el-upload__tip" style="color:red" slot="tip">仅允许导入“jpg”或“png”格式文件！</div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm8">确 定</el-button>
        <el-button type="info" @click="upload8.open= false">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import {
  listRepordRecord,
  listRepordRecord1,
  getRepordRecord,
  delRepordRecord,
  addRepordRecord,
  updateRepordRecord,
  exportRepordRecord,
  exportRepordRecord1,
  resubmit,
  resubmit1,
  get_base_industry
} from "@/api/insurance/repordRecord";
import {uploadTmage, uploadTmage1} from "@/api/base/template";
import {listIndustry} from "@/api/insurance/industry";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Template from "../../base/template/index";
import {getRepordRecord1} from "../../../api/insurance/repordRecord";
import {seacond_admin} from "@/api/insurance/user";
export default {
  name: "RepordRecord",
  components: {
    Template,
    Treeselect
  },
  data() {
    return {
      url: process.env.VUE_APP_BASE_API,//地址
      Bushow:true,//营业执照
      show: true,//判断上传图片显示隐藏
      show1: true,//判断上传图片显示隐藏
      show2: true,//判断上传图片显示隐藏
      show3: true,//判断上传图片显示隐藏
      show4: true,//判断上传图片显示隐藏
      show5: true,//判断上传图片显示隐藏
      show6: true,//判断上传图片显示隐藏
      show7: true,//判断上传图片显示隐藏
      show8: true,//判断上传图片显示隐藏
      fileList: [],
      fileList1: [],
      fileList2: [],
      fileList3: [],
      fileList4: [],
      fileList5: [],
      fileList6: [],
      fileList7: [],
      fileList8: [],
      //上传身份证
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传住院小结
      upload1: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传病例本
      upload2: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传医疗发票
      upload3: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传用药清单
      upload4: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传其他图片
      upload5: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传劳动合同单位营业执照
      upload6: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传劳动合同单位营业执照
      upload7: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      //上传劳动合同单位营业执照
      upload8: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
      },
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      ids1:'',
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 报案表格数据
      repordRecordList: [],
      // 职业分类树选项
      industryOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 状态字典
      statusOptions: [],
      statusOptions1:[ {
        dictValue:0,
        dictLabel:'否'
      },
        {
          dictValue:1,
          dictLabel:'是'
        }],
      // 查询参数
      queryParams: {
        user_id:'',
        id:'',
        pageNum: 1,
        pageSize: 10,
        name: null,//姓名
        actualUnit:null,//实际用工单位
        laborUnit:null,//劳动合同单位
        businessUnit:null,//业务来源单位
        accidentTime: null,//事故发生时间
        industryId: null,
        description: null,
        industryName: null,
        estimateMoney: null,
        status:null,
        createTime:null,//报案日期
        insUserId:'',//报案id
        year: '',
        months: [],
        quarters: [],
        userId:'',//被保险人id
      },
      // 表单参数
      form: {
        id: null,//编辑的id
        insure_no:'',//保单号
        medical_invoice:null,//事故现场照片
        id_card:'',//手持身份证照片
        medical_history:'',//受伤部位照片
        name:'',//保单用户姓名
        createTime:'',//报案时间
        idCardNo:'',//保单用户证件号码
        laborUnit:'',//劳动合同单位
        actualUnit:'',//实际用工单位
        industryName:'',//工种名称
        area:'',//所属地区
        accidentTime:'',//事故时间
        accident_type:'',//事故类型
        accident_area:'',//事故地点
        injured_part:'',//受伤部位
        is_fracture :'',     //  是否骨折 0否 1是
        treatment:'',//治疗方式
        number:'',//住院几楼几号装
        estimateMoney:'',//预估金额
        hospital:'',//医院
        description:'',//事故描述经过
        identity_card:[],//身份证图片地址
        hospitalized:[],//住院小结地址
        medical_record_book:[],//病例本图片地址
        hospital_invoice:[],//医疗发票地址
        medications:[],//用药清单地址
        other:[],//其他图片地址

      },
      // 表单校验
      rules: {},
      accidentType:[],//事故类型
      queryParams3:{
        user_id:'',
        role_id:'',
      },
      insured:[],//被保险人
    };
  },
  created() {
    this.queryParams.user_id = JSON.parse(localStorage.getItem('userInfo')).userId;
    var user=JSON.parse(localStorage.getItem('userInfo'));
    this.queryParams3.user_id=user.userId;
    if (user.roles.length!=0){
      this.queryParams3.role_id=user.roles[0].roleId
    }
    seacond_admin(this.queryParams3).then(res=>{
      this.insured=res.data;
      // console.log('被保险人数据',res)
    })
    var peopleNum = this.$route.query.peopleNum;
    // console.log('num', peopleNum)
    //从首页跳转过来的根据年月季度查询数据
    if (peopleNum != undefined) {
      this.queryParams.year = peopleNum.year;
      this.queryParams.months = peopleNum.month;
      this.queryParams.quarters = peopleNum.quarters;
      this.queryParams.userId = peopleNum.sys_id;

    }

    //在线报案完成之后根据用户id查询是否已经报案
    var insureUser=this.$route.query.insureUser;
    if (insureUser != undefined) {
     this.queryParams.insUserId=insureUser.id;
      // console.log('num',  this.queryParams.insUserId)
    }
    //根据报案id查询当前报案
    var id=this.$route.query.reportId
    if (id!=undefined){
      this.queryParams.id=id;
      // console.log('45467', this.queryParams.id)
    }
    this.getList();

    this.getDicts("accident_type").then(response => {
      // console.log('事故类型',response);
      this.accidentType = response.data;
    });
    this.getDicts("report_status").then(response => {
      this.statusOptions = response.data;
      // console.log('responsewe', response)
    });
    this.getTreeselect();
  },
  methods: {
    /* 修改表头颜色 */
    tableHeaderColor({ rowIndex }) {
      if (rowIndex === 0) {
        return 'background-color: #304156;color: #fff;font-weight: 400;font-family: Microsoft YaHei;'
      }
    },
    /** 查询报案列表 */

    getList() {
      // console.log('queryParamswe',this.queryParams)
      this.loading = true;
      listRepordRecord1(this.queryParams).then(response => {
        // console.log('response', response)
        this.repordRecordList = response.data.rows;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    //点击上传劳动合同单位
    getBusiness(){
      this.upload6.open=true;
      this.upload6.title="上传身份证"
    },
    //查看详情
    handleDetails(row){

      this.$router.push({
        path:'/business/reportAudit/details',
        query:{
          id:row.id,
          insure_no:row.insure_no,
          user_name:row.user_name

        }
      })
    },
    //资料上传
    handeImage(row){
      console.log('row',row)
      this.$router.push({
        path:'/business/repordRecord/repordImage',
        query:{
          id:row.id
        }
      })
    },
    //选择工种名称
    selectDepart(e) {
      this.form.industryName = e.name
    },
    /** 查询部门下拉树结构 */
    getTreeselect() {
      get_base_industry().then(response=>{
        // console.log('response职业',response)
        this.industryOptions = [];
        const data = {id: 0, name: '顶级节点', children: []};
        data.children = this.handleTree(response.data, "id", "parent_id");
        this.industryOptions.push(data);
      })
      // listIndustry().then(response => {
      //   this.industryOptions = [];
      //   const data = {id: 0, name: '顶级节点', children: []};
      //   data.children = this.handleTree(response.data, "id", "parentId");
      //   this.industryOptions.push(data);
      //   console.log('工种名称', response);
      //   console.log('industryOptions', this.industryOptions);
      // });
    },
    // 状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.statusOptions, row.status);
    },
    /** 转换职业分类数据结构 */
    normalizer(node) {
      // console.log('node',node)
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.id,
        label: node.name,
        children: node.children
      };
    },
    // 取消按钮
    cancel() {
      this.open = false;
      // this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        insureId: null,//保单id
        id: null,
        name: null,//姓名1
        actual_unit: null,//实际用工单位2
        labor_unit: null,//劳动合同单位3
        businessUnit: null,//业务来源单位4
        accident_time: null,//事故发生时间5
        industry_id: null,//工种6
        description: null,//事情经过7
        industryName: null,//工种名称8
        estimate_money: null,//预估金额单位（元）9
        createTime: null,
        updateTime: null,
        remark: null,//备注
        id_card_no: null,//证件号码10
        accident_type:null,//事故类型
        businesslicense:'',//营业执照
        user_picture:{
          id: null,
          userId: null,
          medical_invoice: [],
          medical_history: [],
          id_card: [],
          hospitalized: [],
          medications: [],
          other:[],
          create_time: null,
          update_time: null,
        }
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
      if (this.repordRecordList.length==selection.length){
        this.ids1='';
      }else {
        this.ids1=this.ids;
      }
    },
    /** 新增按钮操作 */
    handleAdd() {
      // // this.reset();
      // this.open = true;
      // this.title = "添加报案";
      this.$router.push({
        path: '/business/applicationFiling/applicationAdd'
      })
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.open = true;
      this.title = "修改报案";
      // console.log('row',row);
      // this.reset();
      const id = row.id || this.ids
      var obj={
        id:id
      }
      getRepordRecord1(obj).then(res => {
        console.log('详情', res);
        this.form.id=res.data.id;
        this.form.name=res.data.name;
        this.form.createTime=res.data.create_time;
        this.form.insure_no=res.data.insure_no;
        this.form.idCardNo=res.data.id_card_no;
        this.form.laborUnit=res.data.labor_unit;
        this.form.actualUnit=res.data.actual_unit;
        this.form.industryName=res.data.industry_name;
        this.form.area=res.data.area;
        this.form.accidentTime=res.data.accident_time;
        this.form.accident_type=res.data.accident_type.toString()
        this.form.accident_area=res.data.accident_area;
        this.form.injured_part=res.data.injured_part;
        this.form.is_fracture=res.data.is_fracture;
        this.form.treatment=res.data.treatment;
        this.form.number=res.data.number;
        this.form.estimateMoney=res.data.estimate_money;
        this.form.hospital=res.data.hospital;
        this.form.description=res.data.description;
        this.form.medical_invoice=res.data.user_picture.medical_invoice;
        this.form.id_card =res.data.user_picture.id_card;
        this.form.medical_history=res.data.user_picture.medical_history;
        this.form.identity_card=res.data.user_picture.identity_card;
        this.form.hospitalized=res.data.user_picture.hospitalized;
        this.form.medical_record_book=res.data.user_picture.medical_record_book;
        this.form.hospital_invoice=res.data.user_picture.hospital_invoice;
        this.form.medications=res.data.user_picture.medications;
        this.form.other=res.data.user_picture.other;

        // this.form.user_picture=res.data.user_picture;

       console.log('from',this.form)
        if ( this.form.identity_card!=''){
          this.form.identity_card=JSON.parse(this.form.identity_card);
        }
        if ( this.form.hospitalized!=''){
          this.form.hospitalized=JSON.parse(this.form.hospitalized);
        }
        if ( this.form.medical_record_book!=''){
          this.form.medical_record_book=JSON.parse(this.form.medical_record_book);
        }
        if ( this.form.hospital_invoice!=''){
          this.form.hospital_invoice=JSON.parse(this.form.hospital_invoice);
        }
        if ( this.form.medications!=''){
          this.form.medications=JSON.parse(this.form.medications);
        }
        if ( this.form.other!=''){
          this.form.other=JSON.parse(this.form.other);
        }


        if (this.form.identity_card!=''){
          this.show=false;
        }else {
          this.show=true;
        }
        if (this.form.hospitalized!=''){
          this.show1=false;
        }else {
          this.show1=true;
        }
        if (this.form.medical_record_book!=''){
          this.show2=false;
        }else {
          this.show2=true;
        }
        if (this.form.hospital_invoice!=''){
          this.show3=false;
        }else {
          this.show3=true;
        }
        if (this.form.medications!=''){
          this.show4=false;
        }else {
          this.show4=true;
        }
        if ( this.form.other!=''){
          this.show5=false;
        }else {
          this.show5=true;
        }
        if ( this.form.medical_invoice!=null){
          this.show6=false;
        }else {
          this.show6=true;
        }
        if ( this.form.id_card!=null){
          this.show7=false;
        }else {
          this.show7=true;
        }
        if ( this.form.medical_history!=null){
          this.show8=false;
        }else {
          this.show8=true;
        }

      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          // console.log('state',this.form);

          var form1={
            // insureId:this.form.insureId,//保单id
            id: this.form.id,
            name: this.form.name,//姓名1
            medical_invoice:this.form.medical_invoice,
            id_card:this.form.id_card,
            medical_history:this.form.medical_history,
            createTime:this.form.createTime,
            idCardNo:this.form.idCardNo,
            laborUnit:this.form.laborUnit,
            actualUnit:this.form.actualUnit,
            industryName:this.form.industryName,
            area:this.form.area,
            accidentTime:this.form.accidentTime,
            accident_type:this.form.accident_type,
            accident_area:this.form.accident_area,
            injured_part:this.form.injured_part,
            is_fracture:this.form.is_fracture,
            treatment:this.form.treatment,
            number:this.form.number,
            estimateMoney:this.form.estimateMoney,
            hospital:this.form.hospital,
            description:this.form.description,
            identity_card:this.form.identity_card,
            hospitalized:this.form.hospitalized,
            medical_record_book:this.form.medical_record_book,
            hospital_invoice:this.form.hospital_invoice,
            medications:this.form.medications,
            other:this.form.other,

          }
          if (this.form.identity_card!=''){
            form1.identity_card=this.form.identity_card
          }
          if (this.form.hospitalized!=''){
            form1.hospitalized=this.form.hospitalized
          }
          if (this.form.medical_record_book!=''){
            form1.medical_record_book=this.form.medical_record_book
          }
          if (this.form.hospital_invoice!=''){
            form1.hospital_invoice=this.form.hospital_invoice
          }
          if (this.form.medications!=''){
            form1.medications=this.form.medications
          }
          if (this.form.other!=''){
            form1.other=this.form.other
          }
          // resubmit1(form1).then(response=>{
          //   console.log('response修改', response)
          //   this.msgSuccess("修改成功");
          // })
          resubmit1(form1).then(response => {
              // console.log('response修改', response)
              this.msgSuccess("修改成功");
              this.open = false;
              this.getList();

            })
               // console.log('form1',form1)

        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除报案编号为"' + ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        return delRepordRecord(ids);
      }).then(() => {
        this.getList();
        this.msgSuccess("删除成功");
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      var that=this;
      const queryParams = this.queryParams;
      var obj={
        ids:this.ids1
      }
      console.log('obj',obj)
      this.$confirm('是否确认导出报案数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(function () {
        const loading = that.$loading({
          lock: true,
          text: '请耐心等待正在导出数据...',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
        // console.log('obj',obj)
        exportRepordRecord1(obj).then(response=>{
          loading.close();
          let link = document.createElement('a'); // 创建a标签
          link.style.display = 'none';
          let objectUrl = response.data;
          link.href = objectUrl;
          link.click();
          that.msgSuccess(response.msg);
          // console.log('response24',response)
        })
      // exportRepordRecord(queryParams).then(response=>{
      //   loading.close();
      //   that.$message({
      //     message: '导出数据成功!',
      //     type: 'success'
      //   });
      //   that.download(response.msg);
      // });
      }).then(response => {

      })
    },
    getidCard() {
      this.upload.open = true;
      this.upload.title = "上传身份证照片"
    },
    getidCard1() {
      this.upload1.open = true;
      this.upload1.title = "上传住院小结照片"
    },
    getidCard2() {
      this.upload2.open = true;
      this.upload2.title = "上传病历本照片"
    },
    getidCard3() {
      this.upload3.open = true;
      this.upload3.title = "上传医疗发票照片"
    },
    getidCard4() {
      this.upload4.open = true;
      this.upload4.title = "上传用药清单照片"
    },
    getidCard5() {
      this.upload5.open = true;
      this.upload5.title = "上传其他照片"
    },
    getidCard6() {
      this.upload5.open = true;
      this.upload5.title = "上传事故现场照片"
    },
    getidCard7() {
      this.upload5.open = true;
      this.upload5.title = "上传手持身份证照片"
    }, getidCard8() {
      this.upload5.open = true;
      this.upload5.title = "上传受伤部位照片"
    },

    // 上传身份证式显示
    beforeUploadForm(file) {
      // console.log('file12', file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');

      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传身份证
    handleUpdateForm(param) {
      this.fileList.push(param.file);
    },
    submitFileForm(){
      this.$refs.upload.submit();
      let that = this;
      let formData = new FormData();
      this.fileList.forEach(v=>{
        formData.append('files',v);
      })

      uploadTmage1(formData).then(response => {
        this.fileList=[];
        // this.urlImage = response.url;
        this.form.identity_card= response.fileName
        // this.formData.seal = response.fileName;
        if (this.form.identity_card.length !=0) {
          this.show = false;
        } else {
          this.show = true;
        }
        this.upload.open=false
        // console.log('res', response)

      })
    },
    // 上传住院小结格式显示
    beforeUploadForm1(file) {
      // console.log('file12',file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');

      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传住院小结
    handleUpdateForm1(param) {
      this.fileList1.push(param.file);
    },
    submitFileForm1(){
      this.$refs.upload1.submit();
      let that = this;
      let formData = new FormData();
      this.fileList1.forEach(v=>{
        formData.append('files',v);
      })
      uploadTmage1(formData).then(response => {
        this.fileList1=[];
        // this.urlImage = response.url;
        this.form.hospitalized = response.fileName
        // this.formData.seal = response.fileName;
        if ( this.form.hospitalized.length != 0) {
          this.show1 = false;
        } else {
          this.show1 = true;
        }
        this.upload1.open=false
        // console.log('res', response)
      })
    },
    // 上传病例本显示
    beforeUploadForm2(file) {
      // console.log('file12',file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');

      }
      if (!isLt2M) {
        this.$message.error('章大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传病例本
    handleUpdateForm2(param) {
      this.fileList2.push(param.file);

    },
    submitFileForm2(){
      this.$refs.upload2.submit();
      let that = this;
      let formData = new FormData();
      this.fileList2.forEach(v=>{
        formData.append('files',v);
      })
      uploadTmage1(formData).then(response => {
        this.fileList2=[];
        // this.urlImage = response.url;
        this.form.medical_record_book = response.fileName
        // this.formData.seal = response.fileName;
        if (this.form.medical_record_book.length!= 0) {
          this.show2 = false;
        } else {
          this.show2 = true;
        }
        this.upload2.open=false
        // console.log('res', response)
      })
    },
    // 上传医疗发票式显示
    beforeUploadForm3(file) {
      // console.log('file12',file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');

      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传医疗发票
    handleUpdateForm3(param) {
      this.fileList3.push(param.file);
    },
    submitFileForm3(){
      this.$refs.upload3.submit();
      let that = this;
      let formData = new FormData();
      this.fileList3.forEach(v=>{
        formData.append('files',v);
      })
      uploadTmage1(formData).then(response => {
        this.fileList3=[];
        // this.urlImage = response.url;
        this.form.hospital_invoice = response.fileName
        if ( this.form.hospital_invoice.length != 0) {
          this.show3 = false;
        } else {
          this.show3 = true;
        }
        this.upload3.open=false
        // console.log('res', response)
      })
    },
    // 上传用药清单显示
    beforeUploadForm4(file) {
      // console.log('file12',file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');
      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传用药清单
    handleUpdateForm4(param) {
      this.fileList4.push(param.file);
    },
    submitFileForm4(){
      this.$refs.upload4.submit();
      let that = this;
      let formData = new FormData();
      this.fileList4.forEach(v=>{
        formData.append('files',v);
      })
      uploadTmage1(formData).then(response => {
        this.fileList4=[];
        // this.urlImage = response.url;
        this.form.medications = response.fileName
        if (this.form.medications.length!= 0) {
          this.show4 = false;
        } else {
          this.show4 = true;
        }
        this.upload4.open=false
        // console.log('res', response)
      })
    },
    // 上传其他图片显示
    beforeUploadForm5(file) {
      // console.log('file12',file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');

      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传其他图片
    handleUpdateForm5(param) {
      this.fileList5.push(param.file);
    },
    submitFileForm5(){
      this.$refs.upload5.submit();
      let that = this;
      let formData = new FormData();
      this.fileList5.forEach(v=>{
        formData.append('files',v);
      })
      uploadTmage1(formData).then(response => {
        this.fileList5=[];
        // this.urlImage = response.url;
        this.form.other = response.fileName
        if (  this.form.other.length!= 0) {
          this.show5 = false;
        } else {
          this.show5 = true;
        }
        this.upload5.open=false
        // console.log('res', response)
      })
    },
    // 上传事故现场图片
    beforeUploadForm6(file) {
      // console.log('file12', file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');
      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传事故现场图片
    handleUpdateForm6(param) {
      // console.log('param', param)
      this.fileList6.push(param.file);
      // console.log('fileListdf', this.fileList)
    },
    submitFileForm6(){
      this.$refs.upload6.submit();
      let that = this;
      let formData = new FormData();
      this.fileList6.forEach(v=>{
        formData.append('files',v);
      })

      uploadTmage1(formData).then(response => {
        // console.log('res', response)
        this.fileList6=[];
        // this.urlImage = response.url;
        this.form.medical_invoice = response.fileName[0];
        // this.formData.seal = response.fileName;
        if (this.form.medical_invoice !=null) {
          this.show6 = false;
        } else {
          this.show6 = true;
        }
        this.upload6.open=false


      })
    },
    // 手持身份证照片
    beforeUploadForm7(file) {
      // console.log('file12', file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');
      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传手持身份证照片
    handleUpdateForm7(param) {
      // console.log('param', param)
      this.fileList7.push(param.file);
      // console.log('fileListdf', this.fileList)
    },
    submitFileForm7(){
      this.$refs.upload7.submit();
      let that = this;
      let formData = new FormData();
      this.fileList7.forEach(v=>{
        formData.append('files',v);
      })

      uploadTmage1(formData).then(response => {
        // console.log('res', response)
        this.fileList7=[];
        // this.urlImage = response.url;
        this.form.id_card = response.fileName[0];
        // this.formData.seal = response.fileName;
        if (this.form.id_card !=null) {
          this.show7 = false;
        } else {
          this.show7 = true;
        }
        this.upload7.open=false


      })
    },
    // 上传受伤部位照片
    beforeUploadForm8(file) {
      // console.log('file12', file)
      const isPng = file.type === 'image/png' || 'image/jpg' || 'image/jpeg';
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isPng) {
        this.$message.error('只能是png/jpg/jpeg格式!');
      }
      if (!isLt2M) {
        this.$message.error('大小不能超过2MB!');
      }
      return isPng && isLt2M;
    },
    //上传受伤部位照片
    handleUpdateForm8(param) {
      // console.log('param', param)
      this.fileList8.push(param.file);
      // console.log('fileListdf', this.fileList)
    },
    submitFileForm8(){
      this.$refs.upload8.submit();
      let that = this;
      let formData = new FormData();
      this.fileList8.forEach(v=>{
        formData.append('files',v);
      })

      uploadTmage1(formData).then(response => {
        // console.log('res', response)
        this.fileList8=[];
        // this.urlImage = response.url;
        this.form.medical_history  = response.fileName[0];
        // this.formData.seal = response.fileName;
        if (this.form.medical_history  !=null) {
          this.show8 = false;
        } else {
          this.show8= true;
        }
        this.upload8.open=false


      })
    },

  },


};
</script>


